local skel = fk.CreateSkill {
  name = "rmt__linggao",
}

skel:addEffect(fk.GameStart, {
  anim_type = "drawcard",
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name)
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = {}
    for _, name in ipairs({"fire_attack", "lightning", "iron_chain"}) do
      table.insertTable(cards, room:getCardsFromPileByRule(name, 1, "drawPile"))
    end
    if #cards > 0 then
      room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonJustMove, self.name, nil, true, player)
    end
  end,
})

skel:addEffect(fk.DamageInflicted, {
  anim_type = "defensive",
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player
  end,
  on_cost = function (self, event, target, player, data)
    local use = player.room:askToUseCard(player, {
      skill_name = skel.name, pattern = "fire_attack,lightning,iron_chain", cancelable = true,
      prompt = "#rmt__linggao-invoke", extra_data = {exclusive_targets = {player.id}}
    })
    if use then
      event:setCostData(self, use)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:useCard(event:getCostData(self))
    data:preventDamage()
  end,
})

Fk:loadTranslationTable{
  ["rmt__linggao"] = "陵高",
  [":rmt__linggao"] = "游戏开始时，将【闪电】【火攻】【铁索连环】各一张加入手牌。当你受到伤害时，你可以对你使用上述一张同名牌，防止此伤害。",

  ["#rmt__linggao-invoke"] = "陵高：你可以对自己使用一张【闪电】【火攻】或【铁索连环】，防止你受到的伤害",

  ["$rmt__linggao1"] = "朕以恙而未行，卿死，朕心患乃除！",
  ["$rmt__linggao2"] = "列祖在上，朕以佞臣高为祭，誓再造大秦！",
}

return skel
